package com.zls.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/teacher")
public class TeacherController {

    @Secured(value = "ROLE_teacher")//指定角色
    @RequestMapping("add")
    public String add() {
        return "add";
    }

    @PostAuthorize("hasRole('ROLE_teacher')")
    @RequestMapping("delete")
    public String delete() {

        return "delete";
    }

    @PostAuthorize("hasAuthority('update')")
    @RequestMapping("update")
    public String update() {

        return "update";
    }

    @RequestMapping("select")
    public String select() {

        return "select";
    }
}
